package com.cskaoyan.bean.vo.category;

import com.cskaoyan.bean.MarketCategory;
import lombok.Data;

import java.util.List;

/**
 *
 * @author :rain
 * @description
 * @since 2022/06/26 22:31
 */
@Data
public class AdminCategoryVo {
    private Integer id;

    private String name;

    private String keywords;

    private String desc;

    private String iconUrl;

    private String picUrl;

    private String level;

    private Integer pid;

    // private List<AdminCategoryChildrenVo> children;

    private List<AdminCategoryVo> children;

    /**
     * 将marketCategory转换为AdminCategoryVo
     *
     * @param marketCategory 市场分类
     * @return {@link AdminCategoryVo }
     * @author: jinmo
     * @date: 2022/06/27 15:55:47
     */
    public static AdminCategoryVo convertMarketCategoryToAdminCategoryVo(MarketCategory marketCategory) {
        AdminCategoryVo adminCategoryVo = new AdminCategoryVo();
        adminCategoryVo.setId(marketCategory.getId());
        adminCategoryVo.setName(marketCategory.getName());
        adminCategoryVo.setKeywords(marketCategory.getKeywords());
        adminCategoryVo.setDesc(marketCategory.getDesc());
        adminCategoryVo.setIconUrl(marketCategory.getIconUrl());
        adminCategoryVo.setPicUrl(marketCategory.getPicUrl());
        adminCategoryVo.setLevel(marketCategory.getLevel());
        if (marketCategory.getPid() != null && marketCategory.getPid() != 0) {
            adminCategoryVo.setPid(marketCategory.getPid());
        }
        return adminCategoryVo;
    }



    // public static AdminCategoryVo getAdminCatoryInfo(Integer id, String name, String keywords, String desc, String iconUrl, String picUrl, String level) {
    //     AdminCategoryVo adminCategoryVo = new AdminCategoryVo();
    //     adminCategoryVo.setId(id);
    //     adminCategoryVo.setName(name);
    //     adminCategoryVo.setKeywords(keywords);
    //     adminCategoryVo.setDesc(desc);
    //     adminCategoryVo.setIconUrl(iconUrl);
    //     adminCategoryVo.setPicUrl(picUrl);
    //     adminCategoryVo.setLevel(level);
    //
    //     return adminCategoryVo;
    // }

}
